<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%--
  Created by Petro 24.03.13 21:37
--%>
<table>
    <tbody>
    <c:forEach var="message" items="${list}">
        <tr>
            <td onclick="document.location='/users/${message.receiver.id}';" style="cursor: pointer">
                <c:choose>
                    <c:when test="${not empty message.receiver.photo}">
                        <img src="${pageContext.request.contextPath}/images?id=${message.receiver.id}&size=30" alt="${message.receiver.displayedShortName}">
                    </c:when>
                    <c:otherwise>
                        <img src="/resources/image/default_avatar_30.png" alt="${message.receiver.displayedShortName}">
                    </c:otherwise>
                </c:choose>
            </td>
            <td style="padding: 5px; cursor: pointer" onclick="document.location='/users/${message.receiver.id}';"><c:out value="${message.receiver.displayedShortName}"/></td>
            <td style="padding: 5px; cursor: pointer" onclick="document.location='/msg/${message.id}';"><c:out value="${message.sendDate}"/></td>
            <td style="padding: 5px; cursor: pointer" onclick="document.location='/msg/${message.id}';">
                <c:if test="${not empty message.subject}">
                    <b><c:out value="${message.subject}"/></b><br>
                </c:if>
                <c:out value="${message.body}"/>
            </td>
        </tr>
    </c:forEach>
    </tbody>
</table>